package com.zjy.basic.controller;

import com.zjy.basic.domain.dto.SmsDto;
import com.zjy.basic.service.VerifyCodeService;
import com.zjy.basic.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/verifyCode")
public class VerifyCodeController {
    @Autowired
    private VerifyCodeService verifyCodeService;

    /**
     * 获取图形验证码
     * @param imageCodeKey
     * @return
     */
    @GetMapping("/image/{imageCodeKey}")
    public AjaxResult getVerifyCode(@PathVariable(value = "imageCodeKey") String imageCodeKey){
        return verifyCodeService.getImageCode(imageCodeKey);
    }

    @PostMapping("/smsCode")
    public AjaxResult sendSmsCode(@RequestBody SmsDto dto){
        return verifyCodeService.sendSmsCode(dto);
    }
}
